package com.example.makerspace.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.makerspace.domain.DemandRecordDO;
import com.example.makerspace.mapper.DemandRecordMapper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Component
public class DemandRecordDAO extends  BaseDAO<DemandRecordDO>{
    @Resource
    private DemandRecordMapper demandRecordMapper;

    @PostConstruct
    public void init(){
        this.mapper = demandRecordMapper;
    }

    public List<DemandRecordDO> selectByProductId(Integer productId) {
        QueryWrapper<DemandRecordDO> wrapper= new QueryWrapper<>();
        wrapper.eq("product_id",productId);
        return  mapper.selectList(wrapper);
    }
}
